package Eyjafjalla.action;

import Eyjafjalla.panel.CloudEnergyPanel;
import Eyjafjalla.patch.CloudPatch;
import com.megacrit.cardcrawl.actions.AbstractGameAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.core.Settings;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;

import java.util.Iterator;

public class GainCloudEnergyAction extends AbstractGameAction {
    private int energyGain;

    public GainCloudEnergyAction(int amount) {
        this.setValues(AbstractDungeon.player, AbstractDungeon.player, 0);
        this.duration = Settings.ACTION_DUR_FAST;
        this.energyGain = amount;
    }

    public void update() {
        if (this.duration == Settings.ACTION_DUR_FAST) {
            CloudEnergyPanel.addEnergy(energyGain);

            Iterator var1 = CloudPatch.cloudGroup.group.iterator();

            while(var1.hasNext()) {
                AbstractCard c = (AbstractCard)var1.next();
                c.triggerOnGainEnergy(this.energyGain, true);
            }
        }

        this.tickDuration();
    }
}
